package Presentation;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ResourceBundle;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;

public class BarreBouton  extends javax.swing.JPanel {

    private final JButton btnAide;
    private final JButton btnDeconnexion;
    private final JButton btnRafraichir;

    public BarreBouton(JFrame parent, Onglet onglet) {
        ResourceBundle mainBundle = ResourceBundle.getBundle("ressources/Main/Main", parent.getLocale());
        this.setLayout(new FlowLayout(FlowLayout.RIGHT));
        this.btnAide = new JButton(mainBundle.getString("main.barrebouton.aide"));
        this.btnAide.setBackground(Color.decode("#3f51b5"));
        this.btnAide.setForeground(Color.white);
        this.btnAide.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                onglet.help();
            }
        });
        this.btnDeconnexion = new JButton(mainBundle.getString("main.barrebouton.deconnexion"));
        this.btnDeconnexion.setBackground(Color.decode("#e53935"));
        this.btnDeconnexion.setForeground(Color.white);
        this.btnDeconnexion.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                ((FenetrePrincipale)parent).close();
            }
        });
        this.btnRafraichir = new JButton(new ImageIcon(getClass().getResource("/ressources/images/refresh.png")));
        this.btnRafraichir.setBackground(Color.decode("#4caf50"));
        this.btnRafraichir.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                onglet.rafraichir();
            }
        });
        this.add(this.btnRafraichir);
        this.add(this.btnDeconnexion);
        this.add(this.btnAide);
    }

}
